<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

//权限验证
if( Role::init() == false ){
	exit('没有权限');
}

require $_SERVER['DOCUMENT_ROOT'].'/../_interface/pages.php';
require $_SERVER['DOCUMENT_ROOT'].'/../_interface/name.php';

$db = new DB('star');

$pageSize = 20;//每页显示条数
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
if( $page < 1 ){
	$page = 1;
}

$total_sql = 'select count(*) as num from star where is_del=1';
$total_rs = $db->query($total_sql)->getOne();
$total=$total_rs['num'];//文档总数

//分页html
$page_html = Pages::page($page, $total, $pageSize, '/admin/star/star_lists.php');

$star_sql = 'select * from star where is_del=1 order by index_top desc,orders desc,title_id desc limit '.(($page-1)*$pageSize).','.$pageSize;
$star_rs = $db->query($star_sql)->getAll();

$news_db = new DB('news');
foreach( $star_rs as $key=>$val ){
	//查询姓名
	$create_username = Name::get_username($news_db, $val['create_uid']);
	$star_rs[$key]['create_username'] = $create_username;
}

//包含模板
require template('admin/star/star_lists');